<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('供应商跟踪查询')" />
	<th:block th:include="include :: list-css" />
	<style type="text/css">
		.layui-tab-content{border: 1px solid;padding: 10px 15px;}
		.layui-tab-title li{font-weight:600}
		.layui-tab{margin:0}
	</style>
</head>
<body>
<div class="mid-content">
	<div class="layui-tab" lay-filter="dhtab">
	  <ul class="layui-tab-title">
	    <li class="layui-this" listUrl="/crm/provider/list">供应商资料</li>
	    <li listUrl="/business/orderprocess/group/list" listName="采购合同">采购合同</li>
	    <li listUrl="/business/in/group/list" listName="采购入库">采购入库</li>
	    <li listUrl="/business/paymentprovider/list" listName="付款情况">付款情况</li>
	    <li listUrl="/crm/provider/listarrears" listName="欠款情况">欠款情况</li>
	    <li listUrl="/business/invoicein/group/list" listName="收票情况">收票情况</li>
	  </ul>
	  <div class="layui-tab-content">
	    <table class="layui-hide" id="dhtable" lay-filter="ftable"></table>
	  </div>
	</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: businessJS" />
<script th:inline="javascript">
	/*<![CDATA[*/
	var prefix = ctx + [[${prefix}]],
		gprovide=[[${gprovide}]],
		gridColumns=[[${gridColumns}]],
		business=[[${business}]];
	/*]]>*/
</script>
<script type="text/javascript">
$(".layui-tab-content").css("border-color",pellucidityTen)
var gridBodyMap=[];//表格列集合
gridBodyMap[0]=gridColumns.gridBody;//供应商资料
gridBodyMap[1]=[//采购合同
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建时间"},
	{width: 150, sort: true, field: "bNumb", title: "采购数量", totalRow: true},
	{width: 150, sort: true, field: "fSumje", title: "采购金额", totalRow: true},
	{width: 150, sort: true, field: "fCgSl", title: "采购税率"},
	{width: 150, sort: true, field: "fRkSl", title: "入库数量", totalRow: true},
	{width: 150, sort: true, field: "fSpSl", title: "收票数量", totalRow: true},
	{width: 150, sort: true, field: "fFkJe", title: "付款金额", totalRow: true},
	{width: 150, sort: true, field: "fWFkJe", title: "未付款金额", totalRow: true},
	{width: 150, sort: true, field: "fSpJe", title: "收票金额", totalRow: true},
	{width: 150, sort: true, field: "fWspJe", title: "未收票金额", totalRow: true},
	{width: 150, sort: true, field: "fRkJe", title: "入库金额", totalRow: true},
	{width: 150, sort: true, field: "fWrkJe", title: "未入库金额", totalRow: true},
	{width: 150, sort: true, field: "cidName", title: "所属单位"}
	]
gridBodyMap[2]=[//采购入库
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "入库单号"},
	{width: 150, sort: true, field: "createTime", title: "单据日期"},
	{width: 150, sort: true, field: "bNumb", title: "入库数量", totalRow: true},
	{width: 150, sort: true, field: "fSumje", title: "入库金额", totalRow: true}
	]
gridBodyMap[3]=[//付款情况
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "付款单号"},
	{width: 150, sort: true, field: "vFkLxName", title: "付款类型"},
	{width: 150, sort: true, field: "vFkYh", title: "付款银行"},
	{width: 150, sort: true, field: "createTime", title: "付款日期"},
	{width: 150, sort: true, field: "fSumje", title: "付款金额", totalRow: true}
	]
gridBodyMap[4]=[//欠款情况
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "fRkJe", title: "入库总金额", totalRow: true},
	{width: 150, sort: true, field: "fThJe", title: "退货总金额", totalRow: true},
	{width: 150, sort: true, field: "fFkJe", title: "付款总金额", totalRow: true},
	{width: 150, sort: true, field: "fCgTk", title: "采购退款", totalRow: true},
	{width: 150, sort: true, field: "fYfkJe", title: "应付款余额", totalRow: true},
	{width: 150, sort: true, field: "fSpJe", title: "收票金额", totalRow: true},
	{width: 150, sort: true, field: "fTpJe", title: "退票金额", totalRow: true},
	{width: 150, sort: true, field: "fCwFkJe", title: "财务应付款余额", totalRow: true}
	]
gridBodyMap[5]=[//收票情况
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "开票单号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "单据日期"},
	{width: 150, sort: true, field: "dKpRq", title: "开票日期"},
	{width: 150, sort: true, field: "dSpRq", title: "收票日期"},
	{width: 150, sort: true, field: "vPMan", title: "收票人"},
	{width: 150, sort: true, field: "fSumje", title: "收票金额", totalRow: true},
	{width: 150, sort: true, field: "vFpLxName", title: "发票类型"}
	]
var $,layer,form,element,table,wherestr={};
layui.use(['table','form','layer','jquery','element'], function () {
    $ = layui.$, layer = layui.layer, form = layui.form, table = layui.table, element = layui.element;
    $.tablelist.init({//默认加载合同明细
        elem: '#dhtable'
        ,url: prefix + '/list'
   	 	,where: {'gprovide':gprovide}
    	,even:true
        ,totalRow: true
        ,cols:[gridBodyMap[0]
	 	]
		,height:'full-100'
    });
	//监听排序事件 
    table.on('sort(ftable)', function(obj){
    	$.tablelist.sort('dhtable',obj);
    });
  	//双击行事件：查看单据
	table.on('rowDouble(ftable)', function(obj){
		var tabThis=$('.layui-tab-title').find('.layui-this'),//获取当前选中tab页dom节点
			tName=tabThis.attr('listName'),
			tUrl=tabThis.attr('listUrl');
		if(tName)parent.layui.index.openTabsPage(tUrl.replace('/group','').replace('list','edit?nid=')+obj.data.nid, tName+'('+obj.data.bid+')');
    });
	//监听Tab页
 	element.on('tab(dhtab)', function(data){
 		$.tablelist.init({//表格需重新初始化，重载会继承初始化的参数（不可行）
 			elem: '#dhtable',
 			url:$(this).attr('listUrl'),
 			even:true,
 			where:{'gprovide':gprovide},
 	        height:'full-100',
 	       	totalRow: true,
			cols:[gridBodyMap[data.index]
			]
 		});
	});
 });
</script>
</body>
</html>